<%flags>
	inherit => 'autohandler_noview'
</%flags>
<%args>
	$username => undef
	$password => undef
	$redirect => '.'
</%args>


<%init>

	my $user = $m->comp('users/dao_findByUsernameAndPW.mi', 
		username => $username, password => $password );

	if( defined $user )
	{
		$session{'user'} = $user;
		$session{'user_id'} = $user->{id};
		$session{'user_name'} = $user->{'login'};
	}
	else
	{
		delete $session{'user'};
		delete $session{'user_id'};
		delete $session{'user_name'};
	}
	
	$m->redirect($redirect);

</%init>  